<?php
namespace app\im\model;

use app\BaseModel;
use think\facade\Db;
class ImChart extends BaseModel
{
	protected $name = 'longbing_card_chart';
	
	//创建
	public function createChart($data)
	{
		$data['create_time'] = time();
		return $this->createRow($data);
	}
	
	//更新
	public function updateChart($filter ,$data)
	{
		$filter['deleted'] = 0;
		return $this->updateRow($filter ,$data);
	}
	
	//获取列表
	public function listChart($filter)
	{
		$filter['deleted'] = 0;
		$result = $this->where($filter)->select();
		if(!empty($result))  $result = $result->toArray();
		return $result;
	}
	
	//获取总数
	public function listChartCount($filter)
	{
		$filter['deleted'] = 0;
		return $this->where($filter)->count();
	}
	
	//获取详情
	public function getChart($filter) 
	{
		$filter['deleted'] = 0;
		return $this->getRow($filter);
	}
	
	//删除
	public function delChart($filter)
	{
		$filter['deleted'] = 0;
		return $this->delRow($filter);
	}
	
	//真删除
	public function destoryChart($filter)
	{
		return $this->destoryRow($filter);
	}
}
